﻿Imports Microsoft.VisualBasic.CompilerServices
Imports Microsoft.Win32
Imports System.Management
Imports System.Security.Cryptography
Imports System.IO
Imports System.Text.Encoding
Imports System.Net
Imports System.Security.Principal.WindowsIdentity

Public Class MainForm
    '----------------------------------------------------------------------------------------------------------------------'
    '- ADVANCED ROUTER TESTER - by Dyango                                                                                  '
    '----------------------------------------------------------------------------------------------------------------------'
    'Changelog: V 1.0 17/09/2010 Realease                                                                                  '
    '           V 1.1 10/10/2010 Aggiunta Funzione per il calcolo delle WPA Fastweb Telsey                                 '
    '                            Migliorata Grafica                                                                        '
    '                            Creazione in run-time del file magic-numbers.txt se non esistente                         '
    '           V 1.2 16/10/2010 Aggiunte funzioni automatico, semi-automatico, manuale per il calcolo della WPA           '
    '                            Aggiunto funzione per cercare i M.N velocemente inserendo le prime 3 cifre SSID           '
    '                            Aggiunti nuovi magic numbers                                                              '
    '           V 1.3 26/10/2010 Aggiunta lista dei prefissi mac attualmente registrati                                    '
    '                            Migliorata grafica tab "MAC CHANGER"                                                      '
    '                            Aggiunti nuovi magic numbers                                                              '
    '           V 1.4 07/11/2010 Aggiunta funzione di ricerca nel tab "MAC CHANGER" tramite prefisso o casa produttrice    '
    '                            Aggiunti nuovi magic numbers                                                              '
    '                            Migliorata stabilità e codice del programma                                               '
    '           V 1.5 08/12/2010 Aggiunto funzione per il calcolo dei magic numbers                                        '
    '                            Aggiunta lista degli SSID captati dalla scheda wireless di rete                           '
    '                            Aggiunti nuovi magic numbers                                                              '
    '                            Corretti bug minori                                                                       '
    '           V 1.6 18/12/2010 Aggiunto funzione per calcolare automaticamente le WPA delle reti fastweb nelle vicinanze '
    '                            Reti nelle vicinanze ora riportate in ordine alfabetico                                   '
    '                            Aggiunto Filtro per far restituire solo le reti fastweb e alice nelle vicinanze           '
    '                            Aggiunti e corretti nuovi magic numbers                                                   '
    '                            Corretti bug minori sia grafici che di codice                                             '
    '           V 1.7 19/02/2011 Aggiunta funzione di geolocalizzazione del router                                         '
    '                            Aggiunta funzione per il bruteforce del seriale                                           '
    '                            Aggiunti nuovi magic numbers                                                              '
    '           V 1.8 06/04/2011 Migliorato bruteforce del seriale alice                                                   '
    '                            Aggiunto tab infostrada con il relativo calcolo della wpa                                 '
    '                            Aggiunte descrizioni delle reti quando ci si passa sopra nel listbox                      '  
    '                            Aggiunti più di 100 nuovi magic numbers                                                   '
    '                            Realease pubblica                                                                         '
    '           V 1.9 01/05/2011 Migliorata GUI con una nuova disposizione dei controlli (magic numbers form)              '
    '                            Aggiunto calcolo dell SSID                                                                '
    '                            Aggiunta funzione per la creazione di passwlist per le wpa di alice                       '
    '                            Migliorati i tempi del bruteforce per il seriale (multithreading)                         '
    '                            Aggiunti nuovi magic numbers                                                              '
    '                            Eliminate le serie 181, 182 dai magic numbers                                             '
    '                            Parti di codice revisionate e migliorate (gestione degli errori e ottimizzazioni in alice)'
    '           V 2.0 01/08/2011 Corretto bug durante il calcolo wpa alice semi-automatico                                 '
    '                            Aggiunto controllo per verificare se il router infostrada è houwei                        '
    '                            Rimossa geolocalizzazione causa sospensione del servizio                                  '
    '                            Aggiunta funzione controllo nuova versione (automatico)                                   '
    '                            Corretti bug minori                                                                       '
    '                            Aggiunti nuovi magic numbers                                                              '
    '           V 2.1 02/10/2011 Aggiunto Tab per il calcolo delle reti TeleTu/Tele2                                       '
    '                            Aggiunta funzione per creare manualmente la lista dei M.N in formato .txt                 '
    '                            Aggiunti nuovi magic numbers                                                              '
    '----------------------------------------------------------------------------------------------------------------------'
    'Bug Hunter:                                                                                                           '
    '                                                                                                                      '
    'BUG 1: il prog crea solo i magic numbers di serie presenti in lista per tutte le altre non restituisce niente |FIXED| '
    'bug2: WPA pirelli restituita in modo errato con SSID 38229DF78B7C, wpa corretta = 616770656d verificata personalmente '
    'bug3: cambio mac non sembra funzionare, anche se il val nel reg. di sistema viene modificato |DA TESTARE SUL ALTRI PC|'
    'BUG4: Se il file magic_numbers non esiste, dopo la creazione, l array dei magic numbers non era utilizzazibile |FIXED|' 
    'BUG5:                                                                                                                 ' 
    '                                                                                                                      '
    '----------------------------------------------------------------------------------------------------------------------'
    'Varibili Globali'
    Dim alice_MAC As String = ""
    Dim alice_serial As String = ""
    'Variabili Bruteforce seriale
    Dim perc_brute As Int32 = 0
    Dim SN1_brute As String
    Dim serial_brute As String
    Shared progress As Integer
    Shared progress2 As Integer
    Shared max_progress As Integer
    Dim len_wpa_brute As Byte
    Dim wpa_brute As String
    Dim mac_brute As String
    'Variabili Reti
    Dim nets_info(5) As String
    'Variabili Diagnostica/Benchmark
    Dim velocità As New System.Diagnostics.Stopwatch()
    'Variabili aggiornamento software'
    Dim new_ver_available As Byte = 0

    Private Sub Cmd_DefaultMAC_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Cmd_DefaultMAC.Click
        Try
            Dim root As String = Me.GetRoot(Me.Combo_Networks_List.SelectedItem.ToString)
            Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey(root, True)
            key.DeleteValue("NetworkAddress")
            Dim result As MsgBoxResult = Interaction.MsgBox("L'indirizzo MAC è stato cambiato. E' disabilitare e riabilitare la scheda di rete perchè i cambiamenti abbiano effetto.", MsgBoxStyle.Information, Nothing)
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Function Padding_MAC(ByVal x As String) As String
        Dim str2 As String = x
        If (Strings.Len(x) < 4) Then
            Dim num2 As Integer = (4 - Strings.Len(x))
            Dim i As Integer = 1
            Do While (i <= num2)
                str2 = ("0" & str2)
                i += 1
            Loop
        End If
        Return str2
    End Function

    Private Sub Add_Networks_Interfaces()
        Dim enumerator As System.Management.ManagementObjectCollection.ManagementObjectEnumerator
        Dim instances As ManagementObjectCollection = New ManagementClass("Win32_NetworkAdapterConfiguration").GetInstances
        Try
            enumerator = instances.GetEnumerator
            Do While enumerator.MoveNext
                Dim current As ManagementObject = DirectCast(enumerator.Current, ManagementObject)
                If Operators.ConditionalCompareObjectEqual(current.Item("IPEnabled"), True, False) Then
                    Dim item As String = current.Item("Caption").ToString.Substring(11)
                    Me.Combo_Networks_List.Items.Add(item)
                End If
            Loop
        Finally
            If (Not enumerator Is Nothing) Then
                enumerator.Dispose()
            End If
        End Try
    End Sub

    Private Function GetMACAddress(ByVal Adapter As String) As String
        Dim instances As ManagementObjectCollection = New ManagementClass("Win32_NetworkAdapterConfiguration").GetInstances
        Dim obj2 As ManagementObject
        For Each obj2 In instances
            If (Operators.ConditionalCompareObjectEqual(obj2.Item("IPEnabled"), True, False) AndAlso (obj2.Item("Caption").ToString.Substring(11) = Adapter)) Then
                Return obj2.Item("MacAddress").ToString
            End If
        Next
        Return ""
    End Function

    Private Function GetRoot(ByVal Adapter As String) As String
        Dim str As String = ""
        Dim num As Integer = 0
        Do While True
            Dim str3 As String = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
            Dim str2 As String = Me.Padding_MAC(Conversions.ToString(num))
            Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey((str3 & str2), True)
            Try
                If (key.GetValue("DriverDesc").ToString = Adapter) Then
                    Return (str3 & str2)
                End If
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                ProjectData.ClearProjectError()
                Return str
            End Try
            num += 1
        Loop
    End Function

    Private Function IsHex(ByVal l As String) As Boolean
        Dim str As String = "0123456789ABCDEF"
        Dim i As Integer = 0
        Do While (i <= str.Length - 1)
            If (l = str.Substring(i, 1)) Then
                Return True
            End If
            i += 1
        Loop
        Return False
    End Function

    Private Function Seek_Errors() As Boolean
        If (Me.txtNewMAC.Text = "") Then
            MessageBox.Show("Specificare un indirizzo MAC valido", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return False
        End If
        Dim str As String = Me.txtNewMAC.Text.Replace(":", "")
        If (str.Length <> 12) Then
            MessageBox.Show("L'indirizzo MAC deve essere lungo 12 caratteri", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return False
        End If
        Try
            If (Me.Combo_Networks_List.SelectedItem.ToString = "") Then
                MessageBox.Show("Selezionare prima una scheda di rete", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                Return False
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            MessageBox.Show("Selezionare prima una scheda di rete", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            ProjectData.ClearProjectError()
            Return False
        End Try
        Dim num2 As Integer = (str.Length - 1)
        Dim i As Integer = 0
        Do While (i <= num2)
            If Not Me.IsHex(str.Substring(i, 1)) Then
                MessageBox.Show("L'indirizzo MAC deve essere formato da 6 coppie esadecimali", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                Return False
            End If
            i += 1
        Loop
        Return True
    End Function

    Private Sub txtNewMAC_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles txtNewMAC.KeyPress
        If Not Me.IsHex(Conversions.ToString(e.KeyChar)) Then
            e.KeyChar = ChrW(0)
        End If
    End Sub

    Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        SubForm_Magic_Numers.CanClose = 1
    End Sub

    Private Sub Combo_Networks_List_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combo_Networks_List.SelectedIndexChanged
        lblCurrentMAC.Text = GetMACAddress(Me.Combo_Networks_List.SelectedItem.ToString)
    End Sub

    Private Sub Cmd_CambiaMAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_CambiaMAC.Click
        If Me.Seek_Errors Then
            Dim root As String = Me.GetRoot(Me.Combo_Networks_List.SelectedItem.ToString)
            Registry.LocalMachine.OpenSubKey(root, True).SetValue("NetworkAddress", Me.txtNewMAC.Text.Replace(":", ""))
            Dim result As MsgBoxResult = Interaction.MsgBox("L'indirizzo MAC è stato cambiato. E' disabilitare e riabilitare la scheda di rete perchè i cambiamenti abbiano effetto.", MsgBoxStyle.Information, Nothing)
        End If
    End Sub

    'Scheda calcolo wpa Alice----------------------------------------------------------------------------------------------------'
    Private Sub Cmd_alice_wpa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_alice_wpa.Click
        Try
            listMAC.Items.Clear()
            listSerial.Items.Clear()
            listWPA.Items.Clear()

            If Radio_Auto.Checked = True Then
                alice_MAC = alice_ETH_mac(txtSSID.Text, SubForm_Magic_Numers.magic_num, "")
                listMAC.Items.Add(alice_MAC) 'AGGIUNGO AL LISTBOX IL PREFISSO PIRELLI E SSID CONVERTITO IN HEX
                alice_serial = Alice_Seriale(txtSSID.Text, SubForm_Magic_Numers.magic_num, 0, 0, 0)
                listSerial.Items.Add(alice_serial)
                If alice_serial <> "K e/o Q errati" Then
                    listWPA.Items.Add(Alice_Agpf_WPA(alice_MAC, alice_serial))
                End If

            ElseIf Radio_SemiAuto.Checked = True Then
                If SubForm_Magic_Numers.List_Magic_num.SelectedItem <> "" Then
                    Dim SN1 As String = SubForm_Magic_Numers.List_Magic_num.SelectedItem.Substring(4, 5)
                    Dim Q As Integer = SubForm_Magic_Numers.List_Magic_num.SelectedItem.Substring(13, 8)
                    Dim K As Byte = SubForm_Magic_Numers.List_Magic_num.SelectedItem.Substring(10, 2)
                    Dim MAC As String = SubForm_Magic_Numers.List_Magic_num.SelectedItem.substring(22, 6)

                    alice_MAC = alice_ETH_mac(txtSSID.Text, SubForm_Magic_Numers.magic_num, MAC)
                    listMAC.Items.Add(alice_MAC) 'AGGIUNGO AL LISTBOX IL PREFISSO PIRELLI E SSID CONVERTITO IN HEX
                    alice_serial = Alice_Seriale(txtSSID.Text, SubForm_Magic_Numers.magic_num, SN1, K, Q)
                    listSerial.Items.Add(alice_serial)
                    If alice_serial <> "K e/o Q errati" Then
                        listWPA.Items.Add(Alice_Agpf_WPA(alice_MAC, alice_serial))
                    End If
                Else
                    MsgBox("Selezionare la riga di magic numbers dalla lista prima di avviaree il calcolo")
                End If
            ElseIf Radio_Manuale.Checked = True Then
                If IsNumeric(CInt(txt_Q.Text)) And txt_Q.TextLength = 8 Then
                    alice_MAC = alice_ETH_mac(txtSSID.Text, SubForm_Magic_Numers.magic_num, conbox_manual_mac.SelectedItem)
                    listMAC.Items.Add(alice_MAC) 'AGGIUNGO AL LISTBOX IL PREFISSO PIRELLI E SSID CONVERTITO IN HEX
                    alice_serial = Alice_Seriale(txtSSID.Text, SubForm_Magic_Numers.magic_num, Conbox_manual_sn1.SelectedItem, conbox_manual_k.SelectedItem, txt_Q.Text)
                    listSerial.Items.Add(alice_serial)
                    If alice_serial <> "K e/o Q errati" Then
                        listWPA.Items.Add(Alice_Agpf_WPA(alice_MAC, alice_serial))
                    End If
                Else
                    MsgBox("Q inserito troppo corto o errato")
                End If
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Public Function HexStringToByte(ByVal HEX_Str As String) As Byte()
        Dim byte_Res(HEX_Str.Length / 2 - 1) As Byte
        For i As Byte = 1 To byte_Res.GetUpperBound(0)
            byte_Res(i) = CByte("&h" & Mid(HEX_Str, (i * 2) + 1, 2))
        Next
        Return byte_Res
    End Function

    Private Sub lst_fast_WPA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lst_fast_WPA.SelectedIndexChanged
        Clipboard.SetText(Mid(lst_fast_WPA.SelectedItem, 30, 10))
        MessageBox.Show("WPA copiata nella clipboard")
    End Sub

    Private Sub MainForm_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
        SubForm_Magic_Numers.Location = New Point(Me.Left - 260, Me.Location.Y)
    End Sub

    Private Sub MainForm_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            Me.Visible = False
            NotifyIcon1.Visible = True
        End If
    End Sub

    Private Sub NotifyIcon1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click
        Me.Visible = True
        Me.WindowState = FormWindowState.Normal
        SubForm_Magic_Numers.WindowState = FormWindowState.Normal
    End Sub

    Private Sub Radio_Auto_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio_Auto.CheckedChanged
        If Radio_Auto.Checked = True Then
            Radio_SemiAuto.Checked = False
            Radio_Manuale.Checked = False

            lbl_SN1.Visible = False
            lbl_SN1.Visible = False
            lbl_K.Visible = False
            lbl_Q.Visible = False
            lbl_MAC.Visible = False
            Conbox_manual_sn1.Visible = False
            conbox_manual_k.Visible = False
            txt_Q.Visible = False
            conbox_manual_mac.Visible = False
        End If
    End Sub

    Private Sub Radio_SemiAuto_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio_SemiAuto.CheckedChanged
        If Radio_SemiAuto.Checked = True Then
            Radio_Auto.Checked = False
            Radio_Manuale.Checked = False

            lbl_SN1.Visible = False
            lbl_SN1.Visible = False
            lbl_K.Visible = False
            lbl_Q.Visible = False
            lbl_MAC.Visible = False
            Conbox_manual_sn1.Visible = False
            conbox_manual_k.Visible = False
            txt_Q.Visible = False
            conbox_manual_mac.Visible = False
        End If
    End Sub

    Private Sub Radio_Manuale_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio_Manuale.CheckedChanged
        If Radio_Manuale.Checked = True Then
            Radio_Auto.Checked = False
            Radio_SemiAuto.Checked = False

            lbl_SN1.Visible = True
            lbl_SN1.Visible = True
            lbl_K.Visible = True
            lbl_Q.Visible = True
            lbl_MAC.Visible = True
            Conbox_manual_sn1.Visible = True
            conbox_manual_k.Visible = True
            txt_Q.Visible = True
            conbox_manual_mac.Visible = True

            MessageBox.Show("Inserire i dati manualmente nelle caselle di testo appena comparse")
        End If
    End Sub

    Private Sub listWPA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listWPA.SelectedIndexChanged
        Try
            Clipboard.SetText(listWPA.SelectedItem)
            MessageBox.Show("WPA copiata nella clipboard")
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub listSerial_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listSerial.SelectedIndexChanged
        Try
            Clipboard.SetText(listSerial.SelectedItem)
            MessageBox.Show("Seriale copiato nella clipboard")
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub listMAC_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listMAC.SelectedIndexChanged
        Try
            Clipboard.SetText(listMAC.SelectedItem)
            MessageBox.Show("Mac Ethernet copiato nella clipboard")
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub Cmd_Cerca_Prefix_MAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_Cerca_Prefix_MAC.Click
        Try
            If Rad_Prefix_Mac.Checked = True Then
                List_MAC_Prefix_Risultati.Items.Clear()
                List_MAC_Prefix_Risultati.Items.Add("          - RISULTATI RICERCA -   ")
                For pos As Short = 0 To 13858
                    If UCase(Trim(List_MAC_Prefix.Items.Item(pos).Substring(1, 6)).PadLeft(6, "0")) = UCase(txt_Prefix_Mac.Text) Then
                        List_MAC_Prefix_Risultati.Items.Add(List_MAC_Prefix.Items.Item(pos))
                        Exit For
                    End If
                Next
            ElseIf Rad_Product_Case.Checked = True Then
                List_MAC_Prefix_Risultati.Items.Clear()
                List_MAC_Prefix_Risultati.Items.Add("          - RISULTATI RICERCA -   ")
                For pos2 As Short = 0 To 13858
                    If UCase(LTrim(List_MAC_Prefix.Items.Item(pos2).Substring(7, List_MAC_Prefix.Items.Item(pos2).Length - 7))) = UCase(txt_Product_Case.Text) Then
                        List_MAC_Prefix_Risultati.Items.Add(List_MAC_Prefix.Items.Item(pos2))
                    End If
                Next
            End If
            If List_MAC_Prefix_Risultati.Items.Count() = 1 Then
                List_MAC_Prefix_Risultati.Items.Add("Nessun elemento trovato")
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub txt_Prefix_Mac_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txt_Prefix_Mac.MouseClick
        Rad_Prefix_Mac.Checked = True
        Rad_Product_Case.Checked = False
    End Sub

    Private Sub txt_Product_Case_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_Product_Case.Click
        Rad_Prefix_Mac.Checked = False
        Rad_Product_Case.Checked = True
    End Sub

    Private Sub Check_Genera_MAC_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Check_Genera_MAC.CheckedChanged
        If Check_Genera_MAC.Checked = True Then
            Dim rnd_number As New Random
            Dim rnd_MAC As String = ""
            For i As Byte = 1 To 6
                rnd_MAC &= Hex(rnd_number.Next(256))
            Next
            txtNewMAC.Text = rnd_MAC.PadRight(12, "A")
        ElseIf Check_Genera_MAC.Checked = False Then
            txtNewMAC.Text = ""
        End If
    End Sub

    Private Sub List_MAC_Prefix_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles List_MAC_Prefix.MouseMove
        Dim _tmp As Integer
        Dim _SelectedIthem As Integer
        _tmp = System.Math.Truncate(e.Y / List_MAC_Prefix.ItemHeight) + List_MAC_Prefix.TopIndex
        If _tmp >= List_MAC_Prefix.Items.Count Then _SelectedIthem = -1 : Exit Sub
        If _SelectedIthem <> _tmp Or _SelectedIthem = -1 Then
            _SelectedIthem = _tmp
            ToolTip1.Show(List_MAC_Prefix.Items(_tmp), List_MAC_Prefix, e.X + 10, e.Y, 1)
            Threading.Thread.Sleep(50)
        End If
    End Sub

    Private Sub List_MAC_Prefix_Risultati_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles List_MAC_Prefix_Risultati.MouseMove
        Dim _tmp As Integer
        Dim _SelectedIthem As Integer
        _tmp = System.Math.Truncate(e.Y / List_MAC_Prefix_Risultati.ItemHeight) + List_MAC_Prefix_Risultati.TopIndex
        If _tmp >= List_MAC_Prefix_Risultati.Items.Count Then _SelectedIthem = -1 : Exit Sub
        If _SelectedIthem <> _tmp Or _SelectedIthem = -1 Then
            _SelectedIthem = _tmp
            ToolTip1.Show(List_MAC_Prefix_Risultati.Items(_tmp), List_MAC_Prefix_Risultati, e.X + 10, e.Y, 1)
            Threading.Thread.Sleep(50)
        End If
    End Sub

    Private Sub Cmd_Brute_Seriale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_Brute_Seriale.Click
        Try
            wpa_brute = LCase(txt_wpa2.Text)
            mac_brute = txt_mac_brute.Text
            If Cmbox_sn1.SelectedItem <> Nothing Then
                SN1_brute = Cmbox_sn1.SelectedItem
                txt_brute_seriale.Text = ""
                txt_brute_seriale.Text = "Sto calcolando..."
                timer_brute_serial.Enabled = True
                Bgw_pswlist_bsn.RunWorkerAsync()
                Bgw_pswlist_bsn2.RunWorkerAsync()
            Else
                MessageBox.Show("Nessun SN1 selezionato")
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub Cmd_MANUAL_fast_wpa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_MANUAL_fast_wpa.Click
        If txt_fast_ssid.TextLength = 12 Then
            lst_fast_WPA.Items.Add(detailed_fast_WPA("FASTWEB-1-" & txt_fast_ssid.Text))
        ElseIf txt_fast_ssid.TextLength = 22 Then
            lst_fast_WPA.Items.Add(detailed_fast_WPA(txt_fast_ssid.Text))
        Else
            MessageBox.Show("Controllare la correttezza dell SSID inserito")
        End If
    End Sub

    Private Sub Cmd_AUTO_fast_wpa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_AUTO_fast_wpa.Click
        For Each SSID As String In get_avaible_netwoks()
            If SSID <> Nothing Then
                SSID = SSID.PadLeft(22, "0")
                If SSID.Substring(0, 10) = "FASTWEB-1-" Then
                    lst_fast_WPA.Items.Add(detailed_fast_WPA(SSID))
                End If
            End If
        Next
    End Sub

    Public Sub Check_FILTRO_Alice_fastweb_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Check_FILTRO_Alice_fastweb.CheckedChanged
        Try
            lst_AvaibleSSID.Items.Clear()
            lst_AvaibleSSID.Items.Add("  -      RETI WIFI DISPONIBILI     - ")
            If Check_FILTRO_Alice_fastweb.Checked = True Then
                For Each SSID As String In get_avaible_netwoks()
                    If SSID <> Nothing Then
                        Dim tSSID As String = SSID.PadRight(22, "0")
                        If tSSID.Substring(0, 10) = "FASTWEB-1-" Or tSSID.Substring(0, 6) = "Alice-" Or tSSID.Substring(0, 15) = "InfostradaWiFi-" Then
                            lst_AvaibleSSID.Items.Add(SSID)
                        End If
                    End If
                Next
            ElseIf Check_FILTRO_Alice_fastweb.Checked = False Then
                lst_AvaibleSSID.Items.Clear()
                lst_AvaibleSSID.Items.Add("  -      RETI WIFI DISPONIBILI     - ")
                For Each SSID As String In get_avaible_netwoks()
                    lst_AvaibleSSID.Items.Add(SSID)
                Next
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub Cmd_infostrada_manual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_infostrada_manual.Click
        list_infostrada_wpa.Items.Add("MAC WIFI: " & txt_mac_Infostrada.Text & "WPA: " & "2" & UCase(Replace(txt_mac_Infostrada.Text, ":", "")))
    End Sub

    Private Sub Cmd_infostrada_auto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_infostrada_auto.Click
        Try
            For Each ssid As String In get_avaible_netwoks()
                Dim mac As String = get_mac_address(ssid)
                If ssid.Substring(0, 15) = "InfostradaWiFi-" And mac = "00e04d" Or mac = "c8d5fe" Then    'Controllo se sono router houwei
                    list_infostrada_wpa.Items.Add("MAC WIFI: " & mac & "  " & "WPA: " & "2" & UCase(mac))
                End If
            Next
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub timer_brute_serial_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer_brute_serial.Tick
        Brute_SN_ProgressBar1.Value = ((progress / 500000 * 100) / 2) + ((progress2 / 1000000 * 100) / 2)
    End Sub

    Private Sub list_infostrada_wpa_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles list_infostrada_wpa.SelectedIndexChanged
        Clipboard.SetText(Mid(list_infostrada_wpa.SelectedItem, 30, 13))
        MessageBox.Show("WPA copiata nella clipboard")
    End Sub

    Private Sub lst_AvaibleSSID_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lst_AvaibleSSID.MouseMove
        Try
            Dim _tmp As Integer
            Dim _SelectedIthem As Integer
            Dim tmp2 As Byte
            Dim a, b, c, d, f, g As String

            _tmp = System.Math.Truncate(e.Y / lst_AvaibleSSID.ItemHeight) + lst_AvaibleSSID.TopIndex
            If _tmp <> tmp2 Then
                tmp2 = _tmp
                Dim net_info() As String = get_network_info(lst_AvaibleSSID.Items(_tmp))
                If _tmp >= lst_AvaibleSSID.Items.Count Then _SelectedIthem = -1 : Exit Sub
                If _SelectedIthem <> _tmp Or _SelectedIthem = -1 Then
                    _SelectedIthem = _tmp
                    a = net_info(0)
                    Select Case net_info(1)
                        Case 1
                            b = "Infrastructure"
                        Case 2
                            b = "Independent"
                        Case 3
                            b = "Any"
                        Case Else
                            b = ""
                    End Select

                    Select Case net_info(2)
                        Case 1
                            c = "IEEE80211_Open"
                        Case 2
                            c = "IEEE80211_SharedKey"
                        Case 3
                            c = "WPA"
                        Case 4
                            c = "WPA_PSK"
                        Case 5
                            c = "WPA_None"
                        Case 6
                            c = "RSNA"
                        Case 7
                            c = "RSNA_PSK"
                    End Select

                    Select Case net_info(3)
                        Case 0
                            d = "None"
                        Case 2
                            d = "TKIP"
                        Case 4
                            d = "CCMP"
                        Case 257
                            d = "WEP"
                        Case Else
                            d = net_info(3)
                    End Select

                    Select Case CInt(net_info(4))
                        Case 1 To 29
                            f = "Pot. Segnale: BASSO"
                        Case 30 To 49
                            f = "Pot. Segnale: MEDIO"
                        Case 50 To 69
                            f = "Pot. Segnale: ALTO"
                        Case 70 To 125
                            f = "Pot. Segnale: OTTIMO"
                        Case Else
                            f = net_info(4)
                    End Select
                    g = net_info(5)
                    ToolTip1.Show(a & vbCrLf & b & vbCrLf & c & vbCrLf & d & vbCrLf & f & vbCrLf & g, lst_AvaibleSSID, e.X + 10, e.Y, 300)
                    Threading.Thread.Sleep(750)
                End If
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub lst_AvaibleSSID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lst_AvaibleSSID.SelectedIndexChanged
        If Mid(lst_AvaibleSSID.SelectedItem, 1, 6) = "Alice-" Then
            txtSSID.Text = Mid(lst_AvaibleSSID.SelectedItem, 7)
            txt_pswlist_ssid.Text = Mid(lst_AvaibleSSID.SelectedItem, 7)
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        My.Settings.Item("Nome_pc") = ""
        My.Settings.Item("Nome_utente") = ""
        My.Settings.Item("os") = ""
        My.Settings.Item("Data_Ora") = ""
        My.Settings.Save()
    End Sub

    Private Sub TabFastweb_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabFastweb.Enter
        SubForm_Magic_Numers.CanClose = 1
        SubForm_Magic_Numers.Close()
    End Sub

    Private Sub TabInfostrada_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabInfostrada.Enter
        SubForm_Magic_Numers.CanClose = 1
        SubForm_Magic_Numers.Close()
    End Sub

    Private Sub TabMacChanger_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabMacChanger.Enter
        SubForm_Magic_Numers.CanClose = 1
        SubForm_Magic_Numers.Close()
    End Sub

    Private Sub TabTeleTu_Tele2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabTeleTu_Tele2.Enter
        SubForm_Magic_Numers.CanClose = 1
        SubForm_Magic_Numers.Close()
    End Sub

    Private Sub TabAbout_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabAbout.Enter
        SubForm_Magic_Numers.CanClose = 1
        SubForm_Magic_Numers.Close()
    End Sub

    Private Sub TabAlice_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabAlice.Enter
        SubForm_Magic_Numers.Show()
        SubForm_Magic_Numers.Enabled = True
    End Sub

    Private Sub cmd_calcola_ssid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_calcola_ssid.Click
        Try
            txt_ris_ssid.Text = ""
            For Each mn As String In SubForm_Magic_Numers.magic_num
                If mn.Substring(13, 8) = txt_ssid_q.Text Then
                    txt_ris_ssid.Text = txt_ssid_sn.Text * mn.Substring(10, 2) + txt_ssid_q.Text
                End If
            Next

            If txt_ris_ssid.Text = "" Then
                txt_ris_ssid.AppendText(CStr(txt_ssid_sn.Text * 8 + txt_ssid_q.Text) & "  K = 8" & vbCrLf)
                txt_ris_ssid.AppendText(CStr(txt_ssid_sn.Text * 13 + txt_ssid_q.Text) & "  K = 13")
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub conbox_pswlist_sn1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles conbox_pswlist_sn1.MouseClick
        rad_pswlist_Bsn.Checked = True
        rad_pswlist_kq.Checked = False
    End Sub

    Private Sub conbox_pswlist_k_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles conbox_pswlist_k.MouseClick
        rad_pswlist_Bsn.Checked = False
        rad_pswlist_kq.Checked = True
    End Sub

    Private Sub conbox_pswlist_2sn1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles conbox_pswlist_2sn1.MouseClick
        rad_pswlist_Bsn.Checked = False
        rad_pswlist_kq.Checked = True
    End Sub

    Private Sub txt_pswlist_qi_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txt_pswlist_qi.MouseClick
        rad_pswlist_Bsn.Checked = False
        rad_pswlist_kq.Checked = True
    End Sub

    Private Sub txt_pswlist_qf_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txt_pswlist_qf.MouseClick
        rad_pswlist_Bsn.Checked = False
        rad_pswlist_kq.Checked = True
    End Sub

    Private Sub txt_pswlist_mac_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txt_pswlist_mac.MouseClick
        rad_pswlist_Bsn.Checked = True
        rad_pswlist_kq.Checked = False
    End Sub

    Private Sub cmd_gen_passwlist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_gen_passwlist.Click
        Try
            Dim path As String = Application.StartupPath & "\WPA_" & txt_pswlist_ssid.Text & ".txt"
            Dim twpa As String = ""
            If File.Exists(path) = True Then
                If MessageBox.Show("Il file esiste gia sovrascriverlo?", "\WPA_" & txt_pswlist_ssid.Text, MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
                    Kill(path)
                Else
                    MessageBox.Show("Operazione interrotta")
                    Exit Sub
                End If
            End If
            timer_pswlist.Enabled = True
            If rad_pswlist_Bsn.Checked = True Then
                If conbox_pswlist_sn1.SelectedItem <> "" And txt_pswlist_mac.Text <> "" And txt_pswlist_mac.TextLength = 12 Then
                    cmd_gen_passwlist.Text = "Scrittura Pswlist..."
                    max_progress = 99999
                    Do
                        progress += 1
                        twpa = Alice_Agpf_WPA(txt_pswlist_mac.Text, conbox_pswlist_sn1.SelectedItem & "X0" & CStr(progress).PadLeft(6, "0"))
                        System.IO.File.AppendAllText(path, twpa & vbCrLf)
                        Application.DoEvents()
                    Loop Until progress = max_progress
                    MessageBox.Show("Generazione pswlist completata")
                Else
                    MessageBox.Show("Dati inseriti mancanti o non corretti", "ERRORE")
                End If
            ElseIf rad_pswlist_kq.Enabled = True Then
                If conbox_pswlist_k.SelectedItem <> "" And conbox_pswlist_2sn1.SelectedItem <> "" And txt_pswlist_qi.TextLength = 8 And txt_pswlist_qf.TextLength = 8 Then
                    progress = CInt(txt_pswlist_qi.Text)
                    Dim tmac As String = ""
                    Dim tserial As String = ""
                    cmd_gen_passwlist.Text = "Scrittura Pswlist..."
                    max_progress = txt_pswlist_qf.Text - txt_pswlist_qi.Text
                    tmac = alice_ETH_mac(txt_pswlist_ssid.Text, SubForm_Magic_Numers.magic_num, "")
                    Do
                        progress += 1
                        tserial = Alice_Seriale(txt_pswlist_ssid.Text, SubForm_Magic_Numers.magic_num, conbox_pswlist_2sn1.SelectedItem, conbox_pswlist_k.SelectedItem, progress)
                        If tserial <> "K e/o Q errati" Then
                            twpa = Alice_Agpf_WPA(tmac, tserial)
                            System.IO.File.AppendAllText(path, twpa & vbCrLf)
                        End If
                        Application.DoEvents()
                    Loop Until progress = CInt(txt_pswlist_qf.Text)
                    MessageBox.Show("Generazione pswlist completata")
                End If
            Else
                MessageBox.Show("Dati inseriti mancanti o non corretti", "ERRORE")
            End If
            cmd_gen_passwlist.Text = "Genera PasswList"
            timer_pswlist.Enabled = False
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub Bgw_pswlist_bsn_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles Bgw_pswlist_bsn.DoWork
        Dim twpa As String = ""
        progress = 0
        Do
            progress += 1
            twpa = Alice_Agpf_WPA(mac_brute, SN1_brute & "X0" & CStr(progress).PadLeft(6, "0"))
            If Bgw_pswlist_bsn.CancellationPending Then
                e.Cancel = True
                Exit Sub
            End If
        Loop Until (progress = 500000) Or (twpa = txt_wpa2.Text)
    End Sub

    Private Sub Bgw_pswlist_bsn_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles Bgw_pswlist_bsn.RunWorkerCompleted
        Try
            timer_brute_serial.Enabled = False
            If txt_brute_seriale.Text = "Sto calcolando..." Then
                If progress = 500000 Then
                    txt_brute_seriale.Text = "Nessun SN trovato"
                Else
                    serial_brute = SN1_brute & "X0" & CStr(progress).PadLeft(6, "0")
                    txt_brute_seriale.Text = serial_brute
                End If
                Bgw_pswlist_bsn2.CancelAsync()
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub Bgw_pswlist_bsn2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles Bgw_pswlist_bsn2.DoWork
        Dim twpa As String = ""
        progress2 = 500000
        Do
            progress2 += 1
            twpa = Alice_Agpf_WPA(mac_brute, SN1_brute & "X0" & CStr(progress2).PadLeft(6, "0"))
            If Bgw_pswlist_bsn2.CancellationPending Then
                e.Cancel = True
                Exit Sub
            End If
        Loop Until (progress2 = 999999) Or (twpa = txt_wpa2.Text)
    End Sub

    Private Sub Bgw_pswlist_bsn2_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles Bgw_pswlist_bsn2.RunWorkerCompleted
        Try
            timer_brute_serial.Enabled = False
            If txt_brute_seriale.Text = "Sto calcolando..." Then
                If progress2 = 999999 Then
                    txt_brute_seriale.Text = "Nessun SN trovato"
                Else
                    serial_brute = SN1_brute & "X0" & CStr(progress2).PadLeft(6, "0")
                    txt_brute_seriale.Text = serial_brute
                End If
                Bgw_pswlist_bsn.CancelAsync()
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub timer_pswlist_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer_pswlist.Tick
        Try
            If rad_pswlist_Bsn.Checked = True Then
                ProgrBar_pswlist.Value = progress / max_progress * 100
            ElseIf rad_pswlist_kq.Checked = True Then
                ProgrBar_pswlist.Value = (progress - CInt(txt_pswlist_qi.Text)) / max_progress * 100
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub timer_sw_update_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer_sw_update.Tick
        Try
            If My.Computer.Network.Ping("74.125.79.99") Then
                If WebBrowser1.Document.GetElementById("ReleaseName").InnerText = "ART V 2.2" And new_ver_available = 0 Then
                    new_ver_available = 1
                    If MessageBox.Show("È disponibile una nuova versione vuoi scaricarla ora?", "- Disponibile Nuova versione ART 2.1 -", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
                        Process.Start("http://advancedroutertester.codeplex.com")
                        timer_sw_update.Enabled = False
                    Else
                        Me.Text = "Advanced Router Tester V 2.0  - by DyAnGo - DISPONIBILE VERSIONE 2.1 SU http://advancedroutertester.codeplex.com -  "
                        timer_sw_update.Enabled = False
                    End If
                End If
            End If
        Catch exception1 As Exception
            ProjectData.SetProjectError(exception1)
            ProjectData.ClearProjectError()
        End Try
    End Sub

    Private Sub bgw_start_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgw_start.DoWork
        Dim sr As New StringReader(My.Resources.Mac_Prefix)
        Dim riga As String = sr.ReadLine
        List_MAC_Prefix.Items.Add("- LISTA PREFISSI MAC ESISTENTI -")
        Do Until riga = Nothing
            List_MAC_Prefix.Items.Add(riga)
            riga = sr.ReadLine
        Loop
    End Sub

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        On Error Resume Next
        Me.Show()
        SubForm_Magic_Numers.Show()
        'Controllo termini e condizioni del programma--------------------------------------------------------------<>
        If My.Settings.Item("Nome_pc") = My.Computer.Name And My.Settings.Item("Nome_utente") = GetCurrent.Name And My.Settings.Item("os") = My.Computer.Info.OSFullName Then
            Me.Enabled = True
            SubForm_Magic_Numers.Enabled = True
            txt_Nome_pc.Text = My.Settings.Item("Nome_pc")
            txt_Nome_utente.Text = My.Settings.Item("Nome_utente")
            txt_os.Text = My.Settings.Item("os")
            txt_ora.Text = My.Settings.Item("Data_Ora")
            'Aggiunge nel tab del mac changer le interfacce di rete presenti nel pc------------------------------------<>
main_point:
            Me.Add_Networks_Interfaces()

            'Aggiunge i prefissi mac e le case produttrice a loro associati nel un listbox(List_MAC_Prefix)------------<>
            bgw_start.RunWorkerAsync()

            'Aggiunge nel tab di fastweb/infostrada/teletu le wpa delle reti trovate nelle vicinanze-------------------<>
            For Each SSID As String In get_avaible_netwoks()
                
                Select Case SSID
                    Case "TeletuWi-Fi", "TeleTu_WiFi", "TeleTu", "Tele2", "teleduewifi", "Tele2Wi-Fi", "tele2wifi", "{TeleTu wifi}"
                        Dim mac As String = get_mac_address(SSID)
                        list_teletu_WPA.Items.Add("SSID: " & SSID & "   WPA: " & getWpa_teletu(mac))
                    Case Else
                        SSID = SSID.PadRight(18, "0")
                        If SSID.Substring(0, 10) = "FASTWEB-1-" Then
                            lst_fast_WPA.Items.Add(detailed_fast_WPA(SSID))
                        ElseIf SSID.Substring(0, 15) = "InfostradaWiFi-" Then
                            Dim mac As String = get_mac_address(SSID)
                            list_infostrada_wpa.Items.Add("MAC WIFI: " & mac & "  " & "WPA: " & "2" & UCase(mac))
                        ElseIf SSID.Substring(0, 6) = "tele2_" Or SSID.Substring(0, 7) = "TeleTu_" Then
                            Dim mac As String = get_mac_address(SSID)
                            list_teletu_WPA.Items.Add("SSID: " & SSID & "   WPA: " & getWpa_teletu(mac))
                        End If
                End Select
            Next
        Else
            Term_Condizioni.Show()
            GoTo main_point
        End If

        timer_sw_update.Enabled = True
    End Sub

    Private Sub Cmd_teletu_manual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_teletu_manual.Click
        Dim wpa_teletu As String = ""
        list_teletu_WPA.Items.Add("MAC WIFI: " & txt_mac_teletu.Text & "   WPA: " & getWpa_teletu(txt_mac_teletu.Text))

    End Sub

    Private Sub list_teletu_WPA_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles list_teletu_WPA.SelectedIndexChanged
        Clipboard.SetText(Mid(list_teletu_WPA.SelectedItem, 36, 13))
        MessageBox.Show("WPA copiata nella clipboard")
    End Sub

End Class
    
